<?php
/**
 * Created by PhpStorm.
 * User: 彭奇
 * Date: 2018/9/26
 * Time: 20:59
 */
$name1=$_GET['name1'];
$sex=$_GET['sex'];
$age=$_GET['age'];

echo $name1;
echo $age;
echo $sex;
try{
    $con=new PDO("mysql:dbname=test;host=127.0.0.1", "root", "");
    $con->exec("SET NAMES 'utf8';");
    $sql="INSERT INTO `pq_user`(`name`,`sex`,`age`)VALUES ('$name1','$sex',$age);";
    $con->query($sql);
    echo "成功";
}catch (Exception $e)
{
    echo "链接失败".$e->getMessage();
}
